//
//  CYNewHeightVC.m
//  CreditAddressBook
//
//  Created by mosu on 2016/10/27.
//  Copyright © 2016年 Lee. All rights reserved.
//

#import "CYNewHeightVC.h"
#import "CYUser.h"
#import "CYHttpTool.h"
#import "CYLoginHttpTool.h"
#import "CYJsonInfo.h"
#import "NSObject+MJKeyValue.h"
#import "CYDES3Util.h"
#import "MBProgressHUD+LE.h"
#import "UIAlertView+Block.h"
#import <ZMCreditSDK/ALCreditService.h>
#import "CYGJJDetailVC.h"
#import "CYSBDetail.h"
#import "CYJDDetail.h"
#import "CYYHZXDetail.h"
#import "CYXCZDetail.h"
#import "DCPaymentView.h"
#import "TBWebViewController.h"
#import "CYYYSZDDetailVC.h"
#import "CYYYSManageVC.h"


@interface CYNewHeightVC ()

@property (weak, nonatomic) IBOutlet UIView *yysView;
@property (weak, nonatomic) IBOutlet UIView *gjjView;
@property (weak, nonatomic) IBOutlet UIView *xlView;
@property (weak, nonatomic) IBOutlet UIView *zzfView;
@property (weak, nonatomic) IBOutlet UIView *jszView;
@property (weak, nonatomic) IBOutlet UIView *sbView;
@property (weak, nonatomic) IBOutlet UIView *hyView;
@property (weak, nonatomic) IBOutlet UIView *hjView;
@property (weak, nonatomic) IBOutlet UIView *yhzxbgView;
@property (weak, nonatomic) IBOutlet UIView *taobaoView;

@property (weak, nonatomic) IBOutlet UIView *jdView;
@property (weak, nonatomic) IBOutlet UIView *zgzsView;
@property (weak, nonatomic) IBOutlet UIView *cjrView;
@property (weak, nonatomic) IBOutlet UIView *yhkView;
@property (weak, nonatomic) IBOutlet UIView *xczView;

@property (weak, nonatomic) IBOutlet UIView *sjfxView;

@property (nonatomic, strong)NSString *zmfStr;
@property (nonatomic, strong)NSString *signstr;
@property (nonatomic, strong)NSString *pramstr;
@property (nonatomic, strong)NSString *submitparams;
@property (nonatomic, strong) NSString *mesStr;
@property (nonatomic, strong) NSString *accountStr;
@property (nonatomic, strong)UITextField *zmfdealCodeTF;

@property (nonatomic, strong) UITextField *threeTF;

@property (weak, nonatomic) IBOutlet UILabel *yysLab;
@property (weak, nonatomic) IBOutlet UILabel *gjjLab;
@property (weak, nonatomic) IBOutlet UILabel *xlLab;
@property (weak, nonatomic) IBOutlet UILabel *zmfLab;
@property (weak, nonatomic) IBOutlet UILabel *jszLab;
@property (weak, nonatomic) IBOutlet UILabel *sbLab;
@property (weak, nonatomic) IBOutlet UILabel *hyLab;
@property (weak, nonatomic) IBOutlet UILabel *hjLab;
@property (weak, nonatomic) IBOutlet UILabel *yhzxLab;
@property (weak, nonatomic) IBOutlet UILabel *tbLab;
@property (weak, nonatomic) IBOutlet UILabel *jdLab;
@property (weak, nonatomic) IBOutlet UILabel *zgzsLab;
@property (weak, nonatomic) IBOutlet UILabel *cjrLab;
@property (weak, nonatomic) IBOutlet UILabel *yhkLab;
@property (weak, nonatomic) IBOutlet UILabel *xczLab;
@property (weak, nonatomic) IBOutlet UILabel *yysfxLab;

@property (nonatomic, strong)NSDictionary *yysDic;
@property (nonatomic, strong)NSDictionary *gjjDic;
@property (nonatomic, strong)NSDictionary *xlDic;
@property (nonatomic, strong)NSDictionary *zmfDic;
@property (nonatomic, strong)NSDictionary *jszDic;
@property (nonatomic, strong)NSDictionary *sbDic;
@property (nonatomic, strong)NSDictionary *hyDic;
@property (nonatomic, strong)NSDictionary *hjDic;
@property (nonatomic, strong)NSDictionary *yhzxDic;
@property (nonatomic, strong)NSDictionary *tbDic;
@property (nonatomic, strong)NSDictionary *jdDic;
@property (nonatomic, strong)NSDictionary *zgzsDic;
@property (nonatomic, strong)NSDictionary *cjrDic;
@property (nonatomic, strong)NSDictionary *yhkDic;
@property (nonatomic, strong)NSDictionary *xczDic;
@property (nonatomic, strong)NSDictionary *yysfxDic;

@property (weak, nonatomic) IBOutlet UILabel *zmfStaueLab;

@property (weak, nonatomic) IBOutlet UILabel *topLab;
@property (weak, nonatomic) IBOutlet UIButton *topBtn;
@property (weak, nonatomic) IBOutlet UIView *topView;
@property (nonatomic, strong) NSString *yysstatueStr;
@property (nonatomic, strong) NSString *yysfxStr;



@end

@implementation CYNewHeightVC
-(void)viewWillAppear:(BOOL)animated{
      [self loadstatues];
}

- (void)viewDidLoad {
    [super viewDidLoad];
     
     _yysDic = [[NSDictionary alloc]init];
     _gjjDic = [[NSDictionary alloc]init];
     _xlDic = [[NSDictionary alloc]init];
     _zmfDic = [[NSDictionary alloc]init];
     _jszDic = [[NSDictionary alloc]init];
     _sbDic = [[NSDictionary alloc]init];
     _hyDic= [[NSDictionary alloc]init];
     _hjDic= [[NSDictionary alloc]init];
     _yhzxDic= [[NSDictionary alloc]init];
     _tbDic= [[NSDictionary alloc]init];
     _jdDic= [[NSDictionary alloc]init];
     _zgzsDic = [[NSDictionary alloc]init];
     _cjrDic= [[NSDictionary alloc]init];
     _yhkDic= [[NSDictionary alloc]init];
     _xczDic= [[NSDictionary alloc]init];
     _yysfxDic= [[NSDictionary alloc]init];
     
      [self loadstatues];
    // Do any additional setup after loading the view from its nib.
}
- (IBAction)topbtnClick:(id)sender {
     _topView.hidden = YES;
     
     
}


-(void)loadstatues{
     
     CYUser *user = [CYLoginHttpTool userData].user;
     [MBProgressHUD showMessage:nil toView:self.view];
     [CYHttpTool postWithURL:[CYURL shared].getJuHeStatus params:@{@"userId":user.userId,@"token":user.token} success:^(id json) {
          [MBProgressHUD hideAllHUDsForView:self.view animated:YES];
          CYJsonInfo *jsoninfo = [CYJsonInfo objectWithKeyValues:json];
          [MBProgressHUD hideHUDForView:self.view animated:YES];
          CYLog(@"jsoninfo = %@",jsoninfo.data);
          NSArray *dataArr = jsoninfo.data;
          if (jsoninfo.isSuccess) {
               //
               for (NSDictionary *dic in dataArr) {
                    NSString *statues = [dic objectForKey:@"status"];
                    NSString *name = [dic objectForKey:@"func"];
                    if ([name isEqualToString:@"saveJuHeMno"]) {
                         //运营商数据字典
                         _yysDic = dic;
                         _yysLab.text = [NSString stringWithFormat:@"+%@",[dic objectForKey:@"score"]];
                         
                    }
                    if ([name isEqualToString:@"saveJuHeDegree"]) {
                         //学历数据字典
                         _xlDic = dic;
                         _xlLab.text = [NSString stringWithFormat:@"+%@",[dic objectForKey:@"score"]];
                         
                    }
                    if ([name isEqualToString:@"saveJuHeBankCard"]) {
                         //银行卡数据字典
                         _yhkDic = dic;
                         _yhkLab.text = [NSString stringWithFormat:@"+%@",[dic objectForKey:@"score"]];
                         
                    }
                    if ([name isEqualToString:@"saveJuHeRegister"]) {
                         //户籍数据字典
                         _hjDic = dic;
                         _hjLab.text = [NSString stringWithFormat:@"+%@",[dic objectForKey:@"score"]];
                         
                    }
                    if ([name isEqualToString:@"saveJuHeDrive"]) {
                         //驾照数据字典
                         _jszDic = dic;
                         _jszLab.text = [NSString stringWithFormat:@"+%@",[dic objectForKey:@"score"]];
                         
                    }
                    if ([name isEqualToString:@"saveJuHeMarrage"]) {
                         //结婚证数据字典
                         _hyDic = dic;
                         _hyLab.text = [NSString stringWithFormat:@"+%@",[dic objectForKey:@"score"]];
                         
                    }
                    if ([name isEqualToString:@"saveJuHeFly"]) {
                         //结婚证数据字典
                         _cjrDic = dic;
                         _cjrLab.text = [NSString stringWithFormat:@"+%@",[dic objectForKey:@"score"]];
                         
                    }
                    if ([name isEqualToString:@"saveJuHeProfession"]) {
                         //职业资格证书数据字典
                         _zgzsDic = dic;
                         _zgzsLab.text = [NSString stringWithFormat:@"+%@",[dic objectForKey:@"score"]];
                         
                    }
                    if ([name isEqualToString:@"saveJuHeZmxy"]) {
                         //芝麻信用数据字典
                         _zmfDic = dic;
                         _zmfLab.text = [NSString stringWithFormat:@"最高%@",[dic objectForKey:@"score"]];
                         
                    }
                    if ([name isEqualToString:@"saveJuHeCar"]) {
                         //行驶证数据字典
                         _xczDic = dic;
                         _xczLab.text = [NSString stringWithFormat:@"+%@",[dic objectForKey:@"score"]];
                         
                    }
                    if ([name isEqualToString:@"saveJuHeFundFirst"]) {
                         //公积金数据字典
                         _gjjDic = dic;
                         _gjjLab.text = [NSString stringWithFormat:@"+%@",[dic objectForKey:@"score"]];
                         
                    }
                    if ([name isEqualToString:@"saveJuHeSecurityFirst"]) {
                         //社保数据字典
                         _sbDic = dic;
                         _sbLab.text = [NSString stringWithFormat:@"+%@",[dic objectForKey:@"score"]];
                         
                    }
                    if ([name isEqualToString:@"saveJuHeMnoAccountFirst"]) {
                         //月账单分析数据字典
                         _yysfxDic = dic;
                         _yysfxLab.text = [NSString stringWithFormat:@"+%@",[dic objectForKey:@"score"]];
                         
                    }
                    if ([name isEqualToString:@"saveJuHeBankCreditFirst"]) {
                         //央行征信数据字典
                         _yhzxDic = dic;
                         _yhzxLab.text = [NSString stringWithFormat:@"+%@",[dic objectForKey:@"score"]];
                         
                    }
                    if ([name isEqualToString:@"saveJuHeJingDongFirst"]) {
                         //京东数据字典
                         _jdDic = dic;
                         _jdLab.text = [NSString stringWithFormat:@"+%@",[dic objectForKey:@"score"]];
                         
                    }
                    
                    if ([name isEqualToString:@"saveJuHeTaoBao"]) {
                         //淘宝数据字典
                         _tbDic = dic;
                         _tbLab.text = [NSString stringWithFormat:@"+%@",[dic objectForKey:@"score"]];
                         
                    }
                    

                    //0为未认证
                    if (statues && statues.intValue == 0) {
                         NSString *name = [dic objectForKey:@"func"];
                         if ([name isEqualToString:@"saveJuHeMno"]) {
                              _yysstatueStr = @"0";
                              _yysView.hidden = NO;
                              
                         }
                         if ([name isEqualToString:@"saveJuHeDegree"]) {
                              _xlView.hidden = NO;
                              
                         }
                         if ([name isEqualToString:@"saveJuHeBankCard"]) {
                              _yhkView.hidden = NO;
                              
                         }
                         if ([name isEqualToString:@"saveJuHeRegister"]) {
                              _hjView.hidden = NO;
                              
                         }
                         if ([name isEqualToString:@"saveJuHeDrive"]) {
                              _jszView.hidden = NO;
                              
                         }
                         if ([name isEqualToString:@"saveJuHeMarrage"]) {
                              _hyView.hidden = NO;
                              
                         }
                         if ([name isEqualToString:@"saveJuHeFly"]) {
                              _cjrView.hidden = NO;
                              
                         }
                         if ([name isEqualToString:@"saveJuHeProfession"]) {
                              _zgzsView.hidden = NO;
                              
                         }
                         if ([name isEqualToString:@"saveJuHeZmxy"]) {
                              _zzfView.hidden = NO;
                              _zmfStaueLab.text = @"极大提高借款成功率";
                              
                         }
                         if ([name isEqualToString:@"saveJuHeCar"]) {
                              _xczView.hidden = NO;
                              
                         }
                         if ([name isEqualToString:@"saveJuHeFundFirst"]) {
                              _gjjView.hidden = NO;
                              
                         }
                         if ([name isEqualToString:@"saveJuHeSecurityFirst"]) {
                              _sbView.hidden = NO;
                              
                         }
                         if ([name isEqualToString:@"saveJuHeMnoAccountFirst"]) {
                              _yysfxStr = @"0";
                              _sjfxView.hidden = NO;
                              
                         }
                         if ([name isEqualToString:@"saveJuHeBankCreditFirst"]) {
                              _yhzxbgView.hidden = NO;
                              
                         }
                         if ([name isEqualToString:@"saveJuHeJingDongFirst"]) {
                              _jdView.hidden = NO;
                              
                         }
                         if ([name isEqualToString:@"saveJuHeTaoBao"]) {
                              _taobaoView.hidden = NO;
                              
                         }
                         
                    }else{
                         NSString *name = [dic objectForKey:@"func"];
                         if ([name isEqualToString:@"saveJuHeMno"]) {
                              _yysstatueStr = @"1";
                              _yysView.hidden = YES;
                              
                         }
                         if ([name isEqualToString:@"saveJuHeZmxy"]) {
                              _zzfView.hidden = YES;
                              _zmfStaueLab.text = @"不按时还款影响芝麻信用";
                              
                         }
                         if ([name isEqualToString:@"saveJuHeMnoAccountFirst"]) {
                              _yysfxStr = @"1";
                              _sjfxView.hidden = YES;
                              
                         }
                    }
                    
               }
               
          }
          
     } failure:^(NSError *error) {
          [MBProgressHUD hideHUDForView:self.view animated:YES];
     }];

     
}


//运营商
- (IBAction)yssClick:(id)sender {
     
     CYYYSManageVC *yysmanage = [[CYYYSManageVC alloc]init];
     NSString *yysmes = [_yysDic objectForKey:@"money"];
     NSString *fxmess = [_yysfxDic objectForKey:@"money"];
     NSDictionary *dict =[[NSDictionary alloc] initWithObjectsAndKeys:yysmes,@"yys",fxmess,@"fx", nil];
     yysmanage.mesdic = dict;
     yysmanage.yysstatueStr = _yysstatueStr;
     yysmanage.yysfxStr = _yysfxStr;
     [self.navigationController pushViewController:yysmanage animated:YES];
     
     

//     
     
}

//公积金
- (IBAction)gjjClick:(id)sender {
     NSString *mess = [NSString stringWithFormat:@"公积金认证需要%@元，是否前往？",[_gjjDic objectForKey:@"money"]];
     UIAlertView *alery = [[UIAlertView alloc]initWithTitle:@"提示" message:mess delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"前往", nil];
     [alery showAlertViewWithCompleteBlock:^(NSInteger buttonIndex) {
          if (buttonIndex == 1) {
               CYGJJDetailVC *gjj = [[CYGJJDetailVC alloc]init];
               [self.navigationController pushViewController:gjj animated:YES];

          }
     }];
     
     
}

- (IBAction)xlClick:(id)sender {
     
     DCPaymentView *payAlert = [[DCPaymentView alloc]init];
     payAlert.detail = @"请输入交易密码";
     NSString *mount =[_xlDic objectForKey:@"money"];
     payAlert.amount = mount.doubleValue;
     [payAlert show];
     payAlert.completeHandle = ^(NSString *inputPwd) {
          NSString *desstr = [CYDES3Util encrypt:inputPwd];
          CYUser *user = [CYLoginHttpTool userData].user;
          [MBProgressHUD showMessage:nil toView:self.view];
          [CYHttpTool postWithURL:[CYURL shared].saveJuHeDegree params:@{@"userId":user.userId,@"token":user.token,@"dealCode":desstr} success:^(id json) {
               [MBProgressHUD hideHUDForView:self.view animated:YES];
               CYJsonInfo *jsoninfo = [CYJsonInfo objectWithKeyValues:json];
               CYAlertView(jsoninfo.message);
               if (jsoninfo.isSuccess) {
                    //
                    [self loadstatues];
               }
               
          } failure:^(NSError *error) {
               CYAlertView(@"网络错误");
               [MBProgressHUD hideHUDForView:self.view animated:YES];
          }];
          
          
     };

}

- (IBAction)zmfClick:(id)sender {
     
     [CYHttpTool postWithURL:[CYURL shared].getZhimafenSwitch params:@{} success:^(id json) {
          CYJsonInfo *jsoninfo = [CYJsonInfo objectWithKeyValues:json];
          if (jsoninfo.isSuccess) {
               NSString *zmfswich = jsoninfo.data;
               if (zmfswich.intValue == 0) {
                    //0 关闭，1打开
                    CYAlertView(@"暂未开放");
               }else if (zmfswich.intValue == 1){
                    
                    [self loadparams];
               }
          }
          
     } failure:^(NSError *error) {
          
     }];
}

-(void)loadparams{
     CYUser *user = [CYLoginHttpTool userData].user;
     NSString *mess = [NSString stringWithFormat:@"本次付款金额:%@",[_zmfDic objectForKey:@"money"]];
     UIAlertView *zmfalert = [[UIAlertView alloc]initWithTitle:@"请输入交易密码" message:mess delegate:self cancelButtonTitle:@"返回" otherButtonTitles:@"授权", nil];
     [zmfalert setAlertViewStyle:UIAlertViewStyleSecureTextInput];
     [zmfalert show];
     [zmfalert showAlertViewWithCompleteBlock:^(NSInteger buttonIndex) {
          if (buttonIndex == 1) {
               [MBProgressHUD showMessage:@"加载中..." toView:self.view];
               _zmfdealCodeTF = [zmfalert textFieldAtIndex:0];
               NSString *desstr = [CYDES3Util encrypt:_zmfdealCodeTF.text];
               [CYHttpTool postWithURL:[CYURL shared].generateZMXY params:@{@"userId":user.userId,@"token":user.token,@"dealCode":desstr} success:^(id json) {
                    
                    [MBProgressHUD hideHUDForView:self.view];
                    CYJsonInfo *jsoninfo = [CYJsonInfo objectWithKeyValues:json];
                    CYAlertView(jsoninfo.message);
                    if (jsoninfo.isSuccess) {
                         [MBProgressHUD hideHUDForView:self.view];
                         
                         NSDictionary *dic = jsoninfo.data;
                         CYLog(@"dic = %@",dic);
                         _signstr = [dic objectForKey:@"sign"];
                         _pramstr = [dic objectForKey:@"params"];
                         [self loadZMF];
                    }
                    
               } failure:^(NSError *error) {
                    [MBProgressHUD hideHUDForView:self.view];
               }];
               
               
          }
          
          
          
     }];
     
     
}
-(void)loadZMF{
     
     if (_pramstr&&_signstr) {
          NSString *appId = @"1000406";
          [[ALCreditService sharedService]queryUserAuthReq:appId sign:_signstr params:_pramstr extParams:nil selector:@selector(result:) target:self];
     }
}


- (void)result:(NSMutableDictionary*)dic{
     CYLog(@"dic = %@",dic);
     CYUser *user = [CYLoginHttpTool userData].user;
     _submitparams = [dic objectForKey:@"params"];
     [CYHttpTool postWithURL:[CYURL shared].getZmxyScore params:@{@"userId":user.userId,@"params":_submitparams} success:^(id json) {
          CYJsonInfo *jsoninfo = [CYJsonInfo objectWithKeyValues:json];
          if (jsoninfo.isSuccess) {
               _zmfStr = [NSString stringWithFormat:@"芝麻分:%@",jsoninfo.data];
               NSString *noticeStr = [NSString stringWithFormat:@"您已认证成功,当前芝麻分为:%@",_zmfStr];
               CYAlertView(noticeStr);
               [self loadstatues];
               
          }
          
     } failure:^(NSError *error) {
          
     }];
     
}


- (IBAction)jszClick:(id)sender {
     DCPaymentView *payAlert = [[DCPaymentView alloc]init];
     payAlert.detail = @"请输入交易密码";
     NSString *mount =[_jszDic objectForKey:@"money"];
     payAlert.amount = mount.doubleValue;
     [payAlert show];
     payAlert.completeHandle = ^(NSString *inputPwd) {
          NSString *desstr = [CYDES3Util encrypt:inputPwd];
          CYUser *user = [CYLoginHttpTool userData].user;
          [MBProgressHUD showMessage:nil toView:self.view];
          
          UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"提示" message:@"请输入驾驶证号" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确认", nil];
          [alert setAlertViewStyle:UIAlertViewStylePlainTextInput];
          [alert showAlertViewWithCompleteBlock:^(NSInteger buttonIndex) {
               if (buttonIndex == 1) {
                    _threeTF= [alert textFieldAtIndex:0];
                    if (_threeTF.text.length == 0) {
                         CYAlertView(@"请输入驾驶证号");
                         return ;
                    }
                    [CYHttpTool postWithURL:[CYURL shared].saveJuHeDrive params:@{@"userId":user.userId,@"token":user.token,@"dealCode":desstr,@"jszh":_threeTF.text} success:^(id json) {
                         [MBProgressHUD hideHUDForView:self.view animated:YES];
                         CYJsonInfo *jsoninfo = [CYJsonInfo objectWithKeyValues:json];
                         CYAlertView(jsoninfo.message);
                         if (jsoninfo.isSuccess) {
                              //
                              [self loadstatues];
                         }
                         
                    } failure:^(NSError *error) {
                         CYAlertView(@"网络错误");
                         [MBProgressHUD hideHUDForView:self.view animated:YES];
                    }];
                    
               }
               
          }];
          
     };
}

- (IBAction)sbClick:(id)sender {
     
     
     NSString *mess = [NSString stringWithFormat:@"社保认证需要%@元，是否前往？",[_sbDic objectForKey:@"money"]];
     UIAlertView *alery = [[UIAlertView alloc]initWithTitle:@"提示" message:mess delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"前往", nil];
     [alery showAlertViewWithCompleteBlock:^(NSInteger buttonIndex) {
          if (buttonIndex == 1) {
               CYSBDetail *sb=[[CYSBDetail alloc]init];
               [self.navigationController pushViewController:sb animated:YES];
               
          }
     }];
     
     
      
}

- (IBAction)hyClick:(id)sender {
     
     DCPaymentView *payAlert = [[DCPaymentView alloc]init];
     payAlert.detail = @"请输入交易密码";
     NSString *mount =[_hyDic objectForKey:@"money"];
     payAlert.amount = mount.doubleValue;
     [payAlert show];
     payAlert.completeHandle = ^(NSString *inputPwd) {
          NSString *desstr = [CYDES3Util encrypt:inputPwd];
          CYUser *user = [CYLoginHttpTool userData].user;
          [MBProgressHUD showMessage:nil toView:self.view];
          [CYHttpTool postWithURL:[CYURL shared].saveJuHeMarrage params:@{@"userId":user.userId,@"token":user.token,@"dealCode":desstr} success:^(id json) {
               [MBProgressHUD hideHUDForView:self.view animated:YES];
               CYJsonInfo *jsoninfo = [CYJsonInfo objectWithKeyValues:json];
               CYAlertView(jsoninfo.message);
               if (jsoninfo.isSuccess) {
                    //
                    [self loadstatues];
               }
               
          } failure:^(NSError *error) {
               [MBProgressHUD hideHUDForView:self.view animated:YES];
               CYLog(@"error = %@",error);
               CYAlertView(@"网络错误");
               
          }];
          
     };
}

- (IBAction)hjClick:(id)sender {
     DCPaymentView *payAlert = [[DCPaymentView alloc]init];
     payAlert.detail = @"请输入交易密码";
     NSString *mount =[_hjDic objectForKey:@"money"];
     payAlert.amount = mount.doubleValue;
     [payAlert show];
     payAlert.completeHandle = ^(NSString *inputPwd) {
          NSString *desstr = [CYDES3Util encrypt:inputPwd];
          CYUser *user = [CYLoginHttpTool userData].user;
          [MBProgressHUD showMessage:nil toView:self.view];
          [CYHttpTool postWithURL:[CYURL shared].saveJuHeRegister params:@{@"userId":user.userId,@"token":user.token,@"dealCode":desstr} success:^(id json) {
               [MBProgressHUD hideHUDForView:self.view animated:YES];
               CYJsonInfo *jsoninfo = [CYJsonInfo objectWithKeyValues:json];
               CYAlertView(jsoninfo.message);
               if (jsoninfo.isSuccess) {
                    //
                    [self loadstatues];
               }
               
          } failure:^(NSError *error) {
               [MBProgressHUD hideHUDForView:self.view animated:YES];
               CYLog(@"error = %@",error);
               CYAlertView(@"网络错误");
               
          }];
          
          
     };
}

- (IBAction)yhzxClick:(id)sender {
     
     NSString *mess = [NSString stringWithFormat:@"央行征信认证需要%@元，是否前往？",[_yhzxDic objectForKey:@"money"]];
     UIAlertView *alery = [[UIAlertView alloc]initWithTitle:@"提示" message:mess delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"前往", nil];
     [alery showAlertViewWithCompleteBlock:^(NSInteger buttonIndex) {
          if (buttonIndex == 1) {
               
               CYYHZXDetail *zx = [[CYYHZXDetail alloc]init];
               [self.navigationController pushViewController:zx animated:YES];
               
          }
     }];

}

- (IBAction)tbClick:(id)sender {
     
     NSString *mess = [NSString stringWithFormat:@"淘宝数据分析需要%@元，是否前往？",[_tbDic objectForKey:@"money"]];
     UIAlertView *alery = [[UIAlertView alloc]initWithTitle:@"提示" message:mess delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"前往", nil];
     [alery showAlertViewWithCompleteBlock:^(NSInteger buttonIndex) {
          if (buttonIndex == 1) {
               TBWebViewController *taobaoVC = [[TBWebViewController alloc]init];
               [self.navigationController pushViewController:taobaoVC animated:YES];
          }
     }];
     
    
//     [self presentViewController:taobaoVC animated:YES completion:nil];
     
//     DCPaymentView *payAlert = [[DCPaymentView alloc]init];
//     payAlert.detail = @"请输入交易密码";
//     NSString *mount =[_tbDic objectForKey:@"money"];
//     payAlert.amount = mount.doubleValue;
//
//     [payAlert show];
//     payAlert.completeHandle = ^(NSString *inputPwd) {
//          NSString *desstr = [CYDES3Util encrypt:inputPwd];
//          CYUser *user = [CYLoginHttpTool userData].user;
//          [MBProgressHUD showMessage:nil toView:self.view];
//          [CYHttpTool postWithURL:[CYURL shared].saveJuHeTaoBao params:@{@"userId":user.userId,@"token":user.token,@"dealCode":desstr} success:^(id json) {
//               [MBProgressHUD hideHUDForView:self.view animated:YES];
//               CYJsonInfo *jsoninfo = [CYJsonInfo objectWithKeyValues:json];
//               CYAlertView(jsoninfo.message);
//               if (jsoninfo.isSuccess) {
//                    //
//                    [self loadstatues];
//               }
//               
//          } failure:^(NSError *error) {
//               [MBProgressHUD hideHUDForView:self.view animated:YES];
//               CYLog(@"error = %@",error);
//               CYAlertView(@"网络错误");
//               
//          }];
//          
//          
//     };


}

- (IBAction)jdClick:(id)sender {
     
     NSString *mess = [NSString stringWithFormat:@"京东消费认证需要%@元，是否前往？",[_jdDic objectForKey:@"money"]];
     UIAlertView *alery = [[UIAlertView alloc]initWithTitle:@"提示" message:mess delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"前往", nil];
     [alery showAlertViewWithCompleteBlock:^(NSInteger buttonIndex) {
          if (buttonIndex == 1) {
               CYJDDetail *jd = [[CYJDDetail alloc]init];
               [self.navigationController pushViewController:jd animated:YES];
               
          }
     }];

     
}

- (IBAction)zyzgzsClick:(id)sender {
     
     DCPaymentView *payAlert = [[DCPaymentView alloc]init];
     payAlert.detail = @"请输入交易密码";
     NSString *mount =[_zgzsDic objectForKey:@"money"];
     payAlert.amount = mount.doubleValue;

     [payAlert show];
     payAlert.completeHandle = ^(NSString *inputPwd) {
          NSString *desstr = [CYDES3Util encrypt:inputPwd];
          CYUser *user = [CYLoginHttpTool userData].user;
          [MBProgressHUD showMessage:nil toView:self.view];
          [CYHttpTool postWithURL:[CYURL shared].saveJuHeProfession params:@{@"userId":user.userId,@"token":user.token,@"dealCode":desstr} success:^(id json) {
               [MBProgressHUD hideHUDForView:self.view animated:YES];
               CYJsonInfo *jsoninfo = [CYJsonInfo objectWithKeyValues:json];
               CYAlertView(jsoninfo.message);
               if (jsoninfo.isSuccess) {
                    //
                    [self loadstatues];
               }
               
          } failure:^(NSError *error) {
               [MBProgressHUD hideHUDForView:self.view animated:YES];
               CYLog(@"error = %@",error);
               CYAlertView(@"网络错误");
               
          }];
          
          
     };
}

- (IBAction)cjrtjClick:(id)sender {
     DCPaymentView *payAlert = [[DCPaymentView alloc]init];
     payAlert.detail = @"请输入交易密码";
     NSString *mount =[_cjrDic objectForKey:@"money"];
     payAlert.amount = mount.doubleValue;

     [payAlert show];
     payAlert.completeHandle = ^(NSString *inputPwd) {
          NSString *desstr = [CYDES3Util encrypt:inputPwd];
          CYUser *user = [CYLoginHttpTool userData].user;
          [MBProgressHUD showMessage:nil toView:self.view];
          [CYHttpTool postWithURL:[CYURL shared].saveJuHeFly params:@{@"userId":user.userId,@"token":user.token,@"dealCode":desstr} success:^(id json) {
               [MBProgressHUD hideHUDForView:self.view animated:YES];
               CYJsonInfo *jsoninfo = [CYJsonInfo objectWithKeyValues:json];
               CYAlertView(jsoninfo.message);
               if (jsoninfo.isSuccess) {
                    //
                    [self loadstatues];
               }
               
          } failure:^(NSError *error) {
               [MBProgressHUD hideHUDForView:self.view animated:YES];
               CYLog(@"error = %@",error);
               CYAlertView(@"网络错误");
               
          }];
          
          
     };

}

- (IBAction)yhkClick:(id)sender {
     DCPaymentView *payAlert = [[DCPaymentView alloc]init];
     payAlert.detail = @"请输入交易密码";
     NSString *mount =[_yhkDic objectForKey:@"money"];
     payAlert.amount = mount.doubleValue;

     [payAlert show];
     payAlert.completeHandle = ^(NSString *inputPwd) {
          NSString *desstr = [CYDES3Util encrypt:inputPwd];
          CYUser *user = [CYLoginHttpTool userData].user;
          [MBProgressHUD showMessage:nil toView:self.view];
          [CYHttpTool postWithURL:[CYURL shared].saveJuHeBankCard params:@{@"userId":user.userId,@"token":user.token,@"dealCode":desstr} success:^(id json) {
               [MBProgressHUD hideHUDForView:self.view animated:YES];
               CYJsonInfo *jsoninfo = [CYJsonInfo objectWithKeyValues:json];
               CYAlertView(jsoninfo.message);
               if (jsoninfo.isSuccess) {
                    //
                    [self loadstatues];
               }
               
          } failure:^(NSError *error) {
               [MBProgressHUD hideHUDForView:self.view animated:YES];
               CYLog(@"error = %@",error);
               CYAlertView(@"网络错误");
               
          }];
          
          
     };

}


//待定
- (IBAction)xczClick:(id)sender {
     
     NSString *mess = [NSString stringWithFormat:@"行车证认证需要%@元，是否前往？",[_xczDic objectForKey:@"money"]];
     UIAlertView *alery = [[UIAlertView alloc]initWithTitle:@"提示" message:mess delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"前往", nil];
     [alery showAlertViewWithCompleteBlock:^(NSInteger buttonIndex) {
          if (buttonIndex == 1) {
               CYXCZDetail *xcz = [[CYXCZDetail alloc]init];
               [self.navigationController pushViewController:xcz animated:YES];
          }
     }];

     
    
     
}

//运营商数据分析
- (IBAction)yysrzClick:(id)sender {
     
     NSString *mess = [NSString stringWithFormat:@"运营商数据分析需要%@元，是否前往？",[_yysfxDic objectForKey:@"money"]];
     UIAlertView *alery = [[UIAlertView alloc]initWithTitle:@"提示" message:mess delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"前往", nil];
     [alery showAlertViewWithCompleteBlock:^(NSInteger buttonIndex) {
          if (buttonIndex == 1) {
               CYYYSZDDetailVC *yys = [[CYYYSZDDetailVC alloc]init];
               [self.navigationController pushViewController:yys animated:YES];
          }
     }];
     
     
     
//     DCPaymentView *payAlert = [[DCPaymentView alloc]init];
//     payAlert.detail = @"请输入交易密码";
//     NSString *mount =[_yysfxDic objectForKey:@"money"];
//     payAlert.amount = mount.doubleValue;
//
//     [payAlert show];
//     payAlert.completeHandle = ^(NSString *inputPwd) {
//          NSString *desstr = [CYDES3Util encrypt:inputPwd];
//          CYUser *user = [CYLoginHttpTool userData].user;
//          [MBProgressHUD showMessage:nil toView:self.view];
//          
//          UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"提示" message:@"请输入手机服务密码" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确认", nil];
//          [alert setAlertViewStyle:UIAlertViewStyleSecureTextInput];
//          [alert showAlertViewWithCompleteBlock:^(NSInteger buttonIndex) {
//               if (buttonIndex == 1) {
//                    _threeTF= [alert textFieldAtIndex:0];
//                    if (_threeTF.text.length == 0) {
//                         CYAlertView(@"请输入手机服务密码");
//                         return ;
//                    }
//                    [CYHttpTool postWithURL:[CYURL shared].saveJuHeMnoAccountFirst params:@{@"userId":user.userId,@"token":user.token,@"dealCode":desstr,@"password":_threeTF.text} success:^(id json) {
//                         [MBProgressHUD hideHUDForView:self.view animated:YES];
//                         CYJsonInfo *jsoninfo = [CYJsonInfo objectWithKeyValues:json];
//                         NSString *data = jsoninfo.data;
//                         
//                         if (data && data.intValue == 0) {
//                              UIAlertView *alert1 = [[UIAlertView alloc]initWithTitle:@"提示" message:@"请输入短信验证码" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确认", nil];
//                              [alert1 setAlertViewStyle:UIAlertViewStylePlainTextInput];
//                              [alert1 showAlertViewWithCompleteBlock:^(NSInteger buttonIndex) {
//                                   if (buttonIndex == 1) {
//                                        _threeTF= [alert1 textFieldAtIndex:0];
//                                        if (_threeTF.text.length == 0) {
//                                             CYAlertView(@"请输入短信验证码");
//                                             return ;
//                                        }
//                                        [CYHttpTool postWithURL:[CYURL shared].saveJuHeMnoAccountSecond params:@{@"userId":user.userId,@"token":user.token,@"dealCode":desstr,@"smsCode":_threeTF.text} success:^(id json) {
//                                             [MBProgressHUD hideHUDForView:self.view animated:YES];
//                                             CYJsonInfo *jsoninfo = [CYJsonInfo objectWithKeyValues:json];
//                                             CYAlertView(jsoninfo.message);
//                                             if (jsoninfo.isSuccess) {
//                                                  //
//                                                  
//                                             }
//                                             
//                                        } failure:^(NSError *error) {
//                                             CYAlertView(@"网络错误");
//                                             [MBProgressHUD hideHUDForView:self.view animated:YES];
//                                        }];
//                                        
//                                        
//                                   }
//                                   
//                              }];
//                              
//                         }else{
//                               CYAlertView(jsoninfo.message);
//                              [self loadstatues];
//                         }
//                         
//                    } failure:^(NSError *error) {
//                         CYAlertView(@"网络错误");
//                         [MBProgressHUD hideHUDForView:self.view animated:YES];
//                    }];
//                    
//                    
//               }
//               
//          }];
//          
//          
//          
//          
//     };
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
